package com.ctgu.j13.service;

import com.ctgu.j13.dao.WorkersMapper;
import com.ctgu.j13.vo.Workers;
import com.ctgu.j13.vo.WorkersExample;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class LoginService {

    @Resource
    private WorkersMapper workersMapper;

    public boolean loginCheck(Workers workers)
    {
//        WorkersExample example= new WorkersExample();
//        example.createCriteria().andWorkerAccountEqualTo(workers.getWorkerAccount());
        Workers workers1=workersMapper.selectByPrimaryKey(workers.getWorkerAccount());
        if(workers1!=null)
        {
            if(workers1.getWorkerPassword().equals(workers.getWorkerPassword()))
                return true;
            System.out.println("密码错误");
//            example.createCriteria().andWorkerPasswordEqualTo(workers.getWorkerPassword());
        }
        else
            System.out.println("该用户名不存在");

        return false;
    }



}
